package com.github.codemperor.core.message.dingtalk.robot.bean;

/**
 * 文本类型机器人消息
 */
public class RobotTextMsgRequest extends BaseRobotMsg {
    /**
     * 业务模块, 用于消息第一行头部展示
     */
    private String title;

    /**
     * 内容， 如果需要换行，用\r\n 分隔字符串换行就行
     */
    private Text text;

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Text getText() {
        return text;
    }

    public void setText(Text text) {
        this.text = text;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"title\":\"")
                .append(title).append('\"');
        sb.append(",\"text\":")
                .append(text);
        sb.append(",\"msgtype\":\"")
                .append(msgtype).append('\"');
        sb.append(",\"at\":")
                .append(at);
        sb.append('}');
        return sb.toString();
    }

    public static class Text {
        /**
         * 消息内容。如果需要换行，用\r\n 分隔字符串换行就行
         */
        private String content;

        public String getContent() {
            return content;
        }

        public void setContent(String content) {
            this.content = content;
        }

        @Override
        public String toString() {
            final StringBuilder sb = new StringBuilder("{");
            sb.append("\"content\":\"")
                    .append(content).append('\"');
            sb.append('}');
            return sb.toString();
        }
    }
}
